API Reference
Packages
formance.com/v1beta1
Package v1beta1 contains API Schema definitions for the formance v1beta1 API group.
It allow to configure a Formance stack.
A stack is composed of a Stack resource and some modules.
Each module can create multiple resources following its needs. See Other resources.
Various parts of the stack can be configured either using the CRD properties or using some Settings.
Modules :
Other resources :
- AuthClient
- Benthos
- BenthosStream
- Broker
- BrokerConsumer
- BrokerTopic
- Database
- GatewayHTTPAPI
- ResourceReference
- Versions
Main resources
Stack
Stack represents a formance stack. A Stack is basically a container. It holds some global properties and creates a namespace if not already existing.
To do more, you need to create some modules.
The Stack resource allow to specify the version of the stack.
It can be specified using either the field .spec.version
or the .spec.versionsFromFile
field (Refer to the documentation of Versions resource.
The version
field will have priority over versionFromFile
.
If versions
and versionsFromFile
are not specified, "latest" will be used.
Field | Description | Default | Validation |
---|---|---|---|
apiVersion string | formance.com/v1beta1 | ||
kind string | Stack | ||
metadata ObjectMeta | Refer to Kubernetes API documentation for fields of metadata . | ||
spec StackSpec | |||
status StackStatus |
StackSpec
Field | Description | Default | Validation |
---|---|---|---|
debug boolean | Allow to enable debug mode on the module | false | |
dev boolean | Allow to enable dev mode on the module Dev mode is used to allow some application to do custom setup in development mode (allow insecure certificates for example) | false | |
version string | Version allow to specify the version of the components Must be a valid docker tag | ||
versionsFromFile string | VersionsFromFile allow to specify a formance.com/Versions object which contains individual versions for each component. Must reference a valid formance.com/Versions object | ||
enableAudit boolean | EnableAudit enable audit at the stack level. Actually, it enables audit on Gateway | false | |
disabled boolean | Disabled indicate the stack is disabled. A disabled stack disable everything It just keeps the namespace and the Database resources. | false |
StackStatus
Field | Description | Default | Validation |
---|---|---|---|
ready boolean | Ready indicates if the resource is seen as completely reconciled | ||
info string | Info can contain any additional like reconciliation errors | ||
modules string array | Modules register detected modules |
Settings
Settings represents a configurable piece of the stacks.
The purpose of this resource is to be able to configure some common settings between a set of stacks.
Example :
apiVersion: formance.com/v1beta1
kind: Settings
metadata:
name: postgres-uri
spec:
key: postgres.ledger.uri
stacks:
- stack0
value: postgresql://postgresql.formance.svc.cluster.local:5432
This example create a setting named postgres-uri
targeting the stack named stack0
and the service ledger
(see the key postgres.ledger.uri
).
Therefore, a Database created for the stack stack0
and the service named 'ledger' will use the uri postgresql://postgresql.formance.svc.cluster.local:5432
.
Settings allow to use wildcards in keys and in stacks list.
For example, if you want to use the same database server for all the modules of a specific stack, you can write :
apiVersion: formance.com/v1beta1
kind: Settings
metadata:
name: postgres-uri
spec:
key: postgres.*.uri # There, we use a wildcard to indicate we want to use that setting of all services of the stack `stack0`
stacks:
- stack0
value: postgresql://postgresql.formance.svc.cluster.local:5432
Also, we could use that setting for all of our stacks using :
apiVersion: formance.com/v1beta1
kind: Settings
metadata:
name: postgres-uri
spec:
key: postgres.*.uri # There, we use a wildcard to indicate we want to use that setting for all services of all stacks
stacks:
- * # There we select all the stacks
value: postgresql://postgresql.formance.svc.cluster.local:5432
Some settings are really global, while some are used by specific module.
Refer to the documentation of each module and resource to discover available Settings.
Global settings
AWS account
A stack can use an AWS account for authentication.
It can be used to connect to any AWS service we could use.
It includes RDS, OpenSearch and MSK. To do so, you can create the following setting:
apiVersion: formance.com/v1beta1
kind: Settings
metadata:
name: aws-service-account
spec:
key: aws.service-account
stacks:
- '*'
value: aws-access
This setting instruct the operator than there is somewhere on the cluster a service account named aws-access
.
So, each time a service has the capability to use AWS, the operator will use this service account.
The service account could look like that :
apiVersion: v1
kind: ServiceAccount
metadata:
annotations:
eks.amazonaws.com/role-arn: arn:aws:iam::************:role/staging-eu-west-1-hosting-stack-access
labels:
formance.com/stack: any
name: aws-access
You can note two things :
- We have an annotation indicating the role arn used to connect to AWS. Refer to the AWS documentation to create this role
- We have a label
formance.com/stack=any
indicating we are targeting all stacks. Refer to the documentation of ResourceReference for further information.
JSON logging
You can use the setting logging.json
with the value true
to configure elligible service to log as json.
Example:
apiVersion: formance.com/v1beta1
kind: Settings
metadata:
name: json-logging
spec:
key: logging.json
stacks:
- '*'
value: "true"
Field | Description | Default | Validation |
---|---|---|---|
apiVersion string | formance.com/v1beta1 | ||
kind string | Settings | ||
metadata ObjectMeta | Refer to Kubernetes API documentation for fields of metadata . | ||
spec SettingsSpec |
SettingsSpec
Field | Description | Default | Validation |
---|---|---|---|
stacks string array | Stacks on which the setting is applied. Can contain * to indicate a wildcard. | ||
key string | The setting Key. See the documentation of each module or global settings to discover them. | ||
value string | The value. It must have a specific format following the Key. |
Modules
Auth
Auth represent the authentication module of a stack.
It is an OIDC compliant server.
Creating it for a stack automatically add authentication on all supported modules.
The auth service is basically a proxy to another OIDC compliant server.
Field | Description | Default | Validation |
---|---|---|---|
apiVersion string | formance.com/v1beta1 | ||
kind string | Auth | ||
metadata ObjectMeta | Refer to Kubernetes API documentation for fields of metadata . | ||
spec AuthSpec | |||
status AuthStatus |
AuthSpec
Field | Description | Default | Validation |
---|---|---|---|
debug boolean | Allow to enable debug mode on the module | false | |
dev boolean | Allow to enable dev mode on the module Dev mode is used to allow some application to do custom setup in development mode (allow insecure certificates for example) | false | |
version string | Version allow to override global version defined at stack level for a specific module | ||
stack string | Stack indicates the stack on which the module is installed | ||
delegatedOIDCServer DelegatedOIDCServerConfiguration | Contains information about a delegated authentication server to use to delegate authentication | ||
signingKey string | Allow to override the default signing key used to sign JWT tokens. | ||
signingKeyFromSecret SecretKeySelector | Allow to override the default signing key used to sign JWT tokens using a k8s secret | ||
enableScopes boolean | Allow to enable scopes usage on authentication. If not enabled, each service will check the authentication but will not restrict access following scopes. in this case, if authenticated, it is ok. | false |
DelegatedOIDCServerConfiguration
Field | Description | Default | Validation |
---|---|---|---|
issuer string | Issuer is the url of the delegated oidc server | ||
clientID string | ClientID is the client id to use for authentication | ||
clientSecret string | ClientSecret is the client secret to use for authentication |
AuthStatus
Field | Description | Default | Validation |
---|---|---|---|
ready boolean | Ready indicates if the resource is seen as completely reconciled | ||
info string | Info can contain any additional like reconciliation errors | ||
clients string array | Clients contains the list of clients created using AuthClient |